<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../js/jquery.min.js"></script>
<script src="../js/vue.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<body>
<div id="app">
    <button @click="sendGet()">点击发送一个axios的get请求</button>
    <input v-model="message">{{message}}
</div>
</body>
<script type="text/javascript">
    var vue = new Vue({
        el: "#app",
        data: {
            message: "dfjo"
        },
        methods: {
            sendGet() {
                //表明的是一个发送的axios的get请求括号内为url
                axios.get('/hello/say.do', {
                    params: {
                        msg: "xixi,hello"
                    }
                })
                    .then(function (response) {
                        console.log("接收到数据" + response.data)
                        this.message = response.data
                        console.log("赋值后" + this.message);
                    })
                    .catch(function (error) {
                        alert(error)
                    })
                return this.message;
            }
        }
    })
</script>
</html>